'use strict';

module.exports = app => {
  const { STRING, BIGINT, TINYINT, DATE ,ENUM,INTEGER} = app.Sequelize;

  const User = app.model.define('user', {
    user_id: { type: BIGINT, primaryKey: true, autoIncrement: true },
    openid: { type: STRING(100), unique: true },
    phone: { type: STRING(20), unique: true },
    address: STRING(255),
    sex:ENUM('男','女'),
    real_name: STRING(255),
    id_card: STRING(255),
    password: STRING(100),
    nickname: STRING(100),
    avatar: STRING(100),
    birth_day: STRING(20),
    self_intro: STRING(255),
    user_type: ENUM('user','employer','admin'),
    status: { type: TINYINT, defaultValue: 1 },
    is_certified: { type: TINYINT, defaultValue: 0 },
    del_flag: { type: TINYINT, defaultValue: 0 },
    created_at: DATE,
    updated_at: DATE,
  }, {
    tableName: 'users',
    timestamps: true,
  });

  User.associate = function() {

  };

  return User;
};
